$(function () {
    //初始化datagrid
    clientTrace_datagrid.datagrid({
        fit: true,
        fitColumns: true,
        striped: true,
        url: "/clientTrace/list.do",
        pagination: true,
        rownumbers: true,
        singleSelect: true,
        toolbar: "#clientTrace_toolbar",
        columns: [[
            {
                field: 'client', title: '客户', width: 60, align: 'center', formatter: function (value, row, index) {
                    return value ? value.name : "";
                }
            }, {
                field: 'saleman',
                title: '咨询人员',
                width: 60,
                align: 'center',
                formatter: function (value, row, index) {
                    return value ? value.username : "";
                }
            },
            {field: 'lastTraceTime', title: '本次跟进时间', width: 100, align: 'center'},
            {field: 'nextTraceTime', title: '下次跟进时间', width: 100, align: 'center'},
            {
                field: 'tracePurpose', title: '跟进目的', width: 80, align: 'center',
                formatter: function (value, row, index) {
                    return value ? value.name : "";
                }
            },
            {
                field: 'communicationMethod', title: '咨询方式', width: 80, align: 'center',
                formatter: function (value, row, index) {
                    return value ? value.name : "";
                }
            },
            {field: 'qq', title: 'QQ', width: 80, align: 'center'},
            {field: 'tel', title: '电话', width: 80, align: 'center'},
            {
                field: 'intentionDegree',
                title: '意向程度',
                width: 100,
                align: 'center',
                formatter: function (value, row, index) {
                    return value ? value.name : "";
                }
            },
            {field: 'explaination', title: '审核说明', width: 100, align: 'center'},
            {
                field: 'isAudited',
                title: '审核状态',
                width: 60,
                align: 'center',
                formatter: function (value, row, index) {
                    if (value) {
                        return "<span style='color: red'>已审核</span>";
                    } else {
                        return "未审核";
                    }
                }
            }
        ]]
    });

})